drm/i915/cmdparser: Fix jump whitelist clearing
authorBen Hutchings <ben@decadent.org.uk>
Sun, 10 Nov 2019 22:08:12 +0000 (22:08 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 19 Nov 2019 01:43:33 +0000 (01:43 +0000)
commit6f39dd9038487b1596b85719195c964c4f291f32
tree07a8e15a5851e228fb37c80c1d5696dbdac7d36e
parent8d5c542983a9f2c63e35de340199c6dec99eee05
drm/i915/cmdparser: Fix jump whitelist clearing

When a jump_whitelist bitmap is reused, it needs to be cleared.
Currently this is done with memset() and the size calculation assumes
bitmaps are made of 32-bit words, not longs.  So on 64-bit
architectures, only the first half of the bitmap is cleared.

If some whitelist bits are carried over between successive batches
submitted on the same context, this will presumably allow embedding
the rogue instructions that we're trying to reject.

Use bitmap_zero() instead, which gets the calculation right.

Fixes: f8c08d8faee5 ("drm/i915/cmdparser: Add support for backward jumps")
Cc: stable@vger.kernel.org
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Topic bugfix/x86/i915
Gbp-Pq: Name drm-i915-cmdparser-fix-jump-whitelist-clearing.patch
drivers/gpu/drm/i915/i915_cmd_parser.c